<%@ page language="java" contentType="text/html; charset=utf-8"
	pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"%>
<%@ taglib prefix="shiro" uri="http://shiro.apache.org/tags"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>

<head>
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
    <link href="${basePath}/static/css/bootstrap.css" rel="stylesheet">
    <link href="${basePath}/static/css/style.css" rel="stylesheet">
    <title>产品使用感知收集分析平台</title>
</head>

<body>
    <input value="${basePath}" id="basePath" type="hidden">
    <div class="container">
        <div class="row clearfix">
            <div class="col-xs-12 col-sm-12 col-md-12 col-lg-12 column">
                <img src="${basePath}/static/img/ChinaTelecom.png" width="100%" height="60px">
                <nav class="navbar navbar-default" role="navigation">
                    <div class="navbar-header">
                        <a class="navbar-brand" href="#">产品使用感知收集分析平台</a>
                        <div class="navbar-brand" style="padding: 11px;">
                            <span>切换app</span> <select id="selectProduct">
								<c:forEach var="product" items="${result.object}">
									<option pid=${product.id}>${fn:escapeXml(product.name)}</option>
								</c:forEach>
							</select>
                        </div>
                    </div>
                    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
                        <ul class="nav navbar-nav navbar-right">
                            <li class="dropdown"><a href="#" class="dropdown-toggle" data-toggle="dropdown">欢迎，${currentUser.username}<strong
									class="caret"></strong></a>
                                <ul class="dropdown-menu">
                                    <li><a href="${basePath}/user/logout">登出</a></li>
                                </ul>
                            </li>
                        </ul>
                    </div>
                </nav>
                <div class="row clearfix">
                    <div class="col-xs-2 col-sm-2 col-md-2 col-lg-2 column">
                        <div class="list-group text-center">
                            <shiro:hasRole name="admin">
                                <a href="#" class="list-group-item my" data-toggle="collapse" data-target="#users">用户管理</a>
                                <div id="users" class="collapse in">
                                    <a id="userAdd" href="#" class="list-group-item">添加用户</a> <a id="userList" class="list-group-item">用户列表</a>
                                </div>
                                <a href="#" class="list-group-item my" data-toggle="collapse" data-target="#product">产品管理</a>
                                <div id="product" class="collapse in">
                                    <a id="department" href="#" class="list-group-item">产品部门</a> <a id="productAdd" href="#"
                                        class="list-group-item">新增产品</a> <a id="productList" href="#" class="list-group-item">产品列表</a>
                                </div>
                            </shiro:hasRole>

                            <a href="#" class="list-group-item my" data-toggle="collapse" data-target="#app1">自定义事件</a>
                            <div id="app1" class="collapse in">
                                <a id="appFunction" href="#" class="list-group-item">自定义APP</a>
                                <a id="functionChart" href="#" class="list-group-item">功能统计</a>
                            </div>

                            <a href="#" class="list-group-item my" data-toggle="collapse" data-target="#liveness">活跃度统计</a>
                            <div id="liveness" class="collapse in">
                                <!--<a id="loginTime" href="#" class="list-group-item">启动时间</a> -->
                                <a id="loginTimes" href="#" class="list-group-item">启动次数</a> <a id="clientLiveness" href="#"
                                    class="list-group-item">活跃用户</a> <a id="errorList" href="#" class="list-group-item">错误列表</a>                                <a id="errorReport" href="#" class="list-group-item">错误统计</a>
                            </div>
                            <a href="#" class="list-group-item my" data-toggle="collapse" data-target="#accessManager">访问管理</a>
                            <div id="accessManager" class="collapse in">
                                <a id="accessManagerList" href="#" class="list-group-item">访问路径列表</a>
                                <a id="accessManagerAdd" href="#" class="list-group-item">添加访问路径</a>
                                <a id="accessLogList" href="#" class="list-group-item">访问记录列表</a>

                            </div>




                        </div>
                    </div>
                    <div id="rightDiv" class="col-xs-10	col-sm-10 col-md-10	col-lg-10 column"></div>
                </div>
            </div>
        </div>
    </div>
    <script src="${basePath}/static/js/jquery-1.12.4.min.js"></script>
    <script src="${basePath}/static/js/bootstrap.min.js"></script>
    <!--[if lte IE 9]>
	<script src="${basePath}/static/js/respond.min.js"></script>
	<script src="${basePath}/static/js/html5shiv.js"></script>
	<![endif]-->
    <script src="${basePath}/static/js/highcharts.js"></script>
    <script src="${basePath}/static/plugins/layer/layer.js"></script>
    <script src="${basePath}/static/plugins/laydate/laydate.js"></script>
    <script src="${basePath}/static/plugins/laypage/laypage.js"></script>
    <script src="${basePath}/static/js/bootstrap-treeview.js"></script>
    <script src="${basePath}/static/js/xss.min.js"></script>
    <script type="text/javascript">
		var baseArea = $("#rightDiv");
		var currMenu = "";
		$(function () {
			$(".list-group-item").click(function(){
				currMenu = this.id;
			});
			$("#selectProduct").change(function(){
				if("appFunction" ==currMenu )
				$("#"+currMenu).click();
			});
		    $("#userAdd").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/user/add", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#userList").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/user/list", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#errorList").click(
		        function () {
		            layer.load(1);
		            baseArea.load("${basePath}/appError/list", {
		                productId: $("select[id=selectProduct] :selected")
		                    .attr("pid")
		            }, function () {
		                layer.closeAll('loading');
		            });
		        });
		    $("#errorReport").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/appError/report", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#department").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/product/department", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#productAdd").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/product/add", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#productList").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/product/list", function () {
		            layer.closeAll('loading');
		        });
		    });

		    $("#accessManagerList").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/accessManager/list", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#accessManagerAdd").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/accessManager/add", function () {
		            layer.closeAll('loading');
		        });
		    });
		    $("#accessLogList").click(function () {
		        layer.load(1);
		        baseArea.load("${basePath}/accessLog/list", function () {
		            layer.closeAll('loading');
		        });
		    });

		    $("#appFunction").click(
		        function () {
		            layer.load(1);
		            baseArea.load("${basePath}/appFunction/list", {
		                productId: $("select[id=selectProduct] :selected")
		                    .attr("pid")
		            }, function () {
		                layer.closeAll('loading');
		            });
		        });
		    $("#functionChart").click(
		        function () {
		            layer.load(1);
		            baseArea.load("${basePath}/appFunction/chart", {
		                productId: $("select[id=selectProduct] :selected")
		                    .attr("pid")
		            }, function () {
		                layer.closeAll('loading');
		            });
		        });
		    $("#loginTime").click(
		        function () {
		            layer.load(1);
		            baseArea.load("${basePath}/manager/liveness/loginTime",
		                function () {
		                    layer.closeAll('loading');
		                });
		        });
		    $("#loginTimes")
		        .click(
		            function () {
		                layer.load(1);
		                baseArea
		                    .load(
		                        "${basePath}/manager/liveness/loginTimes", {
		                            productId: $(
		                                    "select[id=selectProduct] :selected")
		                                .attr("pid")
		                        },
		                        function () {
		                            layer.closeAll('loading');
		                        });
		            });
		    $("#clientLiveness")
		        .click(
		            function () {
		                layer.load(1);
		                baseArea
		                    .load(
		                        "${basePath}/manager/liveness/clientLiveness", {
		                            productId: $(
		                                    "select[id=selectProduct] :selected")
		                                .attr("pid")
		                        },
		                        function () {
		                            layer.closeAll('loading');
		                        });
		            });
		});
	</script>
</body>

</html>